package com.bw.zg3_day03lx

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.bw.base.mvvm.BaseActivity
import com.bw.zg3_day03lx.databinding.ActivityMainBinding
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch

@AndroidEntryPoint
@Route(path = "/app/MainActivity")
class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
    val noticeAdapter by lazy { NoticeAdapter() }
    override fun initView() {
        binding.rv.apply {
            adapter = noticeAdapter
            layoutManager = LinearLayoutManager(this@MainActivity)
        }

        lifecycleScope.launch {
            viewModel.getNotice().collect{
                noticeAdapter.submitData(it)
            }
        }
    }

    override fun initData() {

    }
}